<template>
  <HomePanel ref="target" title="人气推荐" sub-title="人气爆款 不容错过">
    <template #right>
      <XtxMore path="/" />
    </template>
    <HomeComponent :list="newData" />
    <!-- <ul class="goods-list">
      <li v-for="item in newData" :key="item.id">
        <RouterLink to="/">
          <p class="name">{{ item.title }}</p>
          <p class="desc">{{ item.alt }}</p>
        </RouterLink>
      </li>
    </ul> -->
  </HomePanel>
</template>

<script>
import HomeComponent from './home-component'
import HomePanel from './home-panel.vue'
import { findHot } from '@/api/home'
import { ref } from 'vue'
import { useObserve } from '@/hook'
export default {
  name: 'HomeHot',
  components: { HomePanel, HomeComponent },
  setup () {
    const newData = ref([])
    async function getNew () {
      const res = await findHot()
      newData.value = res.result
    }
    const { target } = useObserve(getNew)
    // onMounted(() => {
    //   console.log(target)
    //   getNew()
    // })
    return { newData, target }
  }
}
</script>

<style scoped lang='less'>
</style>
